package collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListDemo3 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(i);
        }
        System.out.println(list);

        List<Integer> subList = list.subList(2,8);
        System.out.println("子集:"+subList);

        for (int i = 0; i < subList.size(); i++) {
            subList.set(i,subList.get(i)*10);
//            list.set(i+2,subList.get(i));
        }
        System.out.println(subList);
        System.out.println(list);

        List<Integer> sub = list.subList(1,9);
        sub.clear();

        /*Iterator<Integer> it = sub.iterator();
        while (it.hasNext()){
            it.next();
            it.remove();
        }*/

        System.out.println(list);


    }
}
